<?php echo $header; ?>
	<!-- Start - Left Side -->
	<div id="left" class="span-24 checkout">
		<div id="product_category">
			<div id="product_category_top">
				
				<div class="heading_x span-24">
					<span><?php echo $heading_title; ?></span><hr />
				</div>
				      	&nbsp;
		     		<!-- Category Description -->
			     	 <?php if ($description) { ?>
						<div>
							<?php echo $description; ?>
						</div>
					<?php } ?>
					<!-- Display Error if There are no product in category -->
					<?php if (!$categories && !$products) { ?>
				    	<div class="content">
				    		<?php echo $text_error; ?>
			    		</div>
				    <?php } ?>
				    <!-- Sub Category Thumbnails -->
				    <?php if ($categories) { ?>
					    <table class="list">
					      <?php for ($i = 0; $i < sizeof($categories); $i = $i + 4) { ?>
					      <tr>
					        <?php for ($j = $i; $j < ($i + 4); $j++) { ?>
					        <td width="25%" class="tb_center"><?php if (isset($categories[$j])) { ?>
					          <a href="<?php echo $categories[$j]['href']; ?>"><img src="<?php echo $categories[$j]['thumb']; ?>" title="<?php echo $categories[$j]['name']; ?>" alt="<?php echo $categories[$j]['name']; ?>" style="margin-bottom: 3px;" /></a><br />
					          <a href="<?php echo $categories[$j]['href']; ?>"><?php echo $categories[$j]['name']; ?></a>
					          <?php } ?></td>
					        <?php } ?>
					      </tr>
					      <?php } ?>
					    </table>
					<?php } ?>
			    </div>
			   
			    
			    
			<?php if ($products) { ?>
			    
			    
			    <div class="product-list">
				    <table class="list">
				      <?php for ($i = 0; $i < sizeof($products); $i = $i + 4) { ?>
				      <tr>
				      <?php for ($j = $i; $j < ($i + 4); $j++) { ?>
				      <td style="width: 25%;"><?php if (isset($products[$j])) { ?>
				      <a href="<?php echo str_replace('&', '&amp;', $products[$j]['href']); ?>"><img src="<?php echo $products[$j]['thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" alt="<?php echo $products[$j]['name']; ?>" /></a><br />
				      <a href="<?php echo str_replace('&', '&amp;', $products[$j]['href']); ?>" class="product-name"><?php echo $products[$j]['model']; ?></a><br />
				      <a href="<?php echo str_replace('&', '&amp;', $products[$j]['href']); ?>" class="product-name"><?php echo $products[$j]['name']; ?></a><br />
				      
				      <!--Product Stick-->
					  <div style="display:inline;"> <?php echo $products[$j]['stick']; ?></div><br />
					  <!--/Product Stick-->
				      
				      <!-- Remove Product Model PacharaFixed
				      <span style="color: #999; font-size: 11px;"><?php echo $products[$j]['model']; ?></span><br />
				      -->
				      <?php if ($display_price) { ?>
				      <?php if (!$products[$j]['special']) { ?>
				      <span class="product-price-normal" ><?php echo $products[$j]['price']; ?></span>
				      <?php } else { ?>
				      <span style="color: #900; font-weight: bold; text-decoration: line-through;"><?php echo $products[$j]['price']; ?></span> <span style="color: #F00;"><?php echo $products[$j]['special']; ?></span>
				      <?php } ?>
				      <a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" ><img src="<?php echo HTTPS_IMAGE;?>/data/avon.png" alt="" title="" /></a>
				      <?php } ?>
				      
				      <!-- Removing Product Rating PacharaFixed
				      <br />
				      <?php if ($products[$j]['rating']) { ?>
				      <img src="catalog/view/theme/default/image/stars_<?php echo $products[$j]['rating'] . '.png'; ?>" alt="<?php echo $products[$j]['stars']; ?>" />
				      <?php } ?>
				       -->
				       
				      <?php } ?></td>
				      <?php } ?>
				    </tr>
				      <?php } ?>
				    </table>
			    </div>
			    <div class="sorting span-24">
					<?php 
						foreach ($sorts as $sorts) { 
							echo "<a href='".$sorts["href"]."'>[".$sorts["text"].$text_down_arrow."] </a>";
						}
					?>
				</div>
			    <div class="pagination"><?php echo $pagination; ?></div>
			    <?php } ?>
						    
			</div>	
	      </div>
       	 <!-- End - Left Side -->
       	 


<?php echo $footer; ?> 
<script type="text/javascript"><!-- 
function getURLVar(urlVarName) {
	var urlHalves = String(document.location).toLowerCase().split('?');
	var urlVarValue = '';
	
	if (urlHalves[1]) {
		var urlVars = urlHalves[1].split('&');

		for (var i = 0; i <= (urlVars.length); i++) {
			if (urlVars[i]) {
				var urlVarPair = urlVars[i].split('=');
				
				if (urlVarPair[0] && urlVarPair[0] == urlVarName.toLowerCase()) {
					urlVarValue = urlVarPair[1];
				}
			}
		}
	}
	
	return urlVarValue;
} 

$(document).ready(function() {
	route = getURLVar('route');
	
	if (!route) {
		$('#tab_home').addClass('selected');
	} else {
		part = route.split('/');
		
		if (route == 'common/home') {
			$('#tab_home').addClass('selected');
		} else if (route == 'account/login') {
			$('#tab_login').addClass('selected');	
		} else if (part[0] == 'account') {
			$('#tab_account').addClass('selected');
		} else if (route == 'checkout/cart') {
			$('#tab_cart').addClass('selected');
		} else if (part[0] == 'checkout') {
			$('#tab_checkout').addClass('selected');
		} else {
			$('#tab_home').addClass('selected');
		}
	}
});
//--></script>
<script type="text/javascript"><!--
$('#search input').keydown(function(e) {
	if (e.keyCode == 13) {
		moduleSearch();
	}
});

function moduleSearch() {	
	pathArray = location.pathname.split( '/' );
	
	url = '<?php echo HTTP_SERVER; ?>';
		
	url += 'index.php?route=product/search';
		
	var filter_keyword = $('#filter_keyword').attr('value')
	
	if (filter_keyword) {
		url += '&keyword=' + encodeURIComponent(filter_keyword);
	}
	
	var filter_category_id = $('#filter_category_id').attr('value');
	
	if (filter_category_id) {
		url += '&category_id=' + filter_category_id;
	}
	
	location = url;
}
//--></script>
<script type="text/javascript"><!--
$('.switcher').bind('click', function() {
	$(this).find('.option').slideToggle('fast');
});
$('.switcher').bind('mouseleave', function() {
	$(this).find('.option').slideUp('fast');
}); 
//--></script>

